
const state = {
  consumer: null, // 顾客信息
  receiver: null, // 收货信息
  consultant: null // 家居顾问
}
const mutations = {
  // 更新顾客信息
  updateConsumer(state, data) {
    if (data) {
      const consumerName = data && data.consumerName || ''
      const consumerPhone = data && data.consumerPhone || ''
      const consumerPhoneBak = data && data.consumerPhoneBak || ''
      state.consumer = {
        consumerName,
        consumerPhone,
        consumerPhoneBak
      }
    } else {
      state.consumer = null
    }
  },
  // 更新收货信息
  updateReceiver(state, data) {
    state.receiver = data || null
    /* if (data) {
      state.receiver = data
      const consumer = state.consumer
      if (data && data.consigneeName && !(consumer && consumer.consumerName)) {
        state.consumer = {
          consumerName: data.consigneeName,
          consumerPhone: data.consigneePhone,
          consumerPhoneBak: data.consigneePhoneBak || ''
        }
      }
    } else {
      state.receiver = null
    } */
  },
  // 更新家居顾问
  updateConsultant(state, data) {
    state.consultant = data || null
  }
}
const actions = {

}
const getters = {
  consumer(state) {
    return state.consumer
  },
  receiver(state) {
    return state.receiver
  },
  consultant(state) {
    return state.consultant
  }
}

export default {
  state,
  mutations,
  actions,
  getters,
  namespaced: true
}

